package com.ndp.fb.walle.business;

import com.ndp.fb.exception.BusinessException;
import com.ndp.fb.exception.entrustaccount.FromFBEntrustAccountsIsNullException;
import com.ndp.fb.exception.entrustaccount.GetAccessTokenException;
import com.ndp.fb.exception.entrustaccount.IsNotBusinessesManagerException;
import com.ndp.fb.rdb.model.BusinessManager;
import com.ndp.fb.rdb.model.EntrustAccountExt;
import com.ndp.fb.walle.model.bo.entrustaccount.ChangeAccountResult;

import java.util.List;

/**
 * Created by Mikey.zhaopeng on 2014/10/24 16:00.
 * Email mikey.zhao@ndpmedia.com
 */
public interface FBOauthService {

    List<BusinessManager> syncBusinessManager(String accessToken) throws  IsNotBusinessesManagerException;

    /**
     * 通过code获取 accessToken
     *
     * @param code
     * @return
     */
    String getAccessToken(String code) throws GetAccessTokenException;

    /**
     * 根据 resultFlag 跳转不同的页面
     *
     * @param resultFlag
     * @return
     */
    String getRedirectUrl(String resultFlag);

    Boolean isCanAddFbUser(String userId) throws BusinessException;


    ChangeAccountResult getChangeEntrustAccount(String userId) throws FromFBEntrustAccountsIsNullException, BusinessException;


    List<EntrustAccountExt> paramToEntrustAccount(List<Long> dbEntrustIds, String accessToken) throws FromFBEntrustAccountsIsNullException;


    String addFbUser(String code, String error_code, String error_message, String userId) throws BusinessException;

    /**
     * 更新fbuser
     *
     * @param code
     * @param error_code
     * @param error_message
     * @param userId
     * @return
     * @throws BusinessException
     */
    String updateFbUser(String code, String error_code, String error_message, String userId) throws BusinessException;

    /**
     * @param facebookEntrustAccounts
     * @return
     * @throws BusinessException
     * @discription
     * @author giser.yang
     * 创建时间 2015年6月5日 下午4:29:32
     */
    boolean syncNewEntrustInformation(String userId, List<EntrustAccountExt> facebookEntrustAccounts, List<Long> newAddIds) throws BusinessException;
}
